package com.teapos.service;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.teapos.dao.ConfigDao;
import com.teapos.dao.UserDao;
import com.teapos.util.MD5Util;
import com.teapos.util.Tool;

/**
 * 用户service
 * @author kangrui
 *
 */
@SuppressWarnings({"rawtypes", "unchecked"})
@Service
public class UserService {

	@Autowired
	private UserDao userDao;
	@Autowired
	private ConfigDao configDao;
	
	/**
	 * 登陆校验
	 * @param map
	 * @return
	 */
	public Map checkLogin(Map map) {
		map.put("password_enc", MD5Util.md5(Tool.toString(map.get("password"))));
		return userDao.findUserByNameAndPwd(map);
	}
	
	public Map findUserSaveDiscounts(int role) {
		return configDao.getSaveDiscounts(role);
	}

}
